﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FurniturePlaced : MonoBehaviour
{
    // Start is called before the first frame update
    bool zoomIn = false;
    Vector3 vec = new Vector3(1.3f, 1.3f, 1);
    void Start()
    {
   
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void Placed()
    {
        StartCoroutine(PlacedFurnitureAnim());
    }

    IEnumerator PlacedFurnitureAnim()
    {
        while (true)
        {
            if (!zoomIn)
            {
                if (transform.localScale != new Vector3(1.3f, 1.3f, 1))
                {
                    transform.localScale += new Vector3(0.01f, 0.01f, 0);
                }
                if (Vector3.Distance(transform.localScale, vec) < 0.2f)
                {
                    zoomIn = true;
                }
            }
            else
            {
                transform.localScale = new Vector3(1, 1, 1);
                zoomIn = false;
                StopAllCoroutines();
            }
            yield return new WaitForEndOfFrame();
        }
    }

}
